package com.ddd.core.constants;

import cn.hutool.core.collection.CollectionUtil;

import java.util.Collections;
import java.util.List;

public interface WebConstants {

    String[] EXCLUDE_PATH_PATTERNS = new String[]{
            "/robots.txt",
            "/webjars/**",
            "/favicon.ico",
    };

    String[] SWAGGER_PATH_PATTERNS = new String[]{
            "/v2/api-docs",
            "/v2/api-docs/**",
            "/swagger-resources",
            "/swagger-resources/**",
            "/swagger-ui.html",
            "/swagger-ui.html**",
            "/doc.html",
    };

    String[] LOGIN_INTERCEPTOR_EXCLUDE_PATH_PATTERNS = loginExcludePathPatterns();

    static String[] loginExcludePathPatterns() {
        List<String> result = CollectionUtil.newArrayList();
        Collections.addAll(result, EXCLUDE_PATH_PATTERNS);
        Collections.addAll(result, SWAGGER_PATH_PATTERNS);
        return result.toArray(new String[]{});
    }

}
